package GUI.gameLobbyWin;

import gamePlus.server.GameClientSlot;

import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

@SuppressWarnings("serial")
public class LobbySlotsPanel extends JPanel {
	private LobbySingleSlotPanel[] slots;
	
	public LobbySlotsPanel() {
		super();
		setBorder(new TitledBorder("Gracze"));
		slots = new LobbySingleSlotPanel[4];
		for(int i=0;i<4;i++) {
			slots[i] = new LobbySingleSlotPanel(i+1);
			add(slots[i]);
		}
	}
	
	public void updateInfo(GameClientSlot[] gcSlots) {
		for(int i=0;i<4;i++) {
			slots[i].updateInfo(gcSlots[i]);
		}
	}

	void becameAdministrator() {
		for(int i=0;i<4;i++)
			slots[i].becameAdministrator();
	}

	boolean amIReady() {
		for(int i=0;i<4;i++)
			if(slots[i].isMe()&&slots[i].isReady())
				return true;
		return false;
	}
}
